import * as React from 'react';
import AppBar from '@mui/material/AppBar';
import Box from '@mui/material/Box';
import Toolbar from '@mui/material/Toolbar';
import Typography from '@mui/material/Typography';
import Button from '@mui/material/Button';
import IconButton from '@mui/material/IconButton';
import MenuIcon from '@mui/icons-material/Menu';
import Client from "../Client"
export default function ButtonAppBar(props) {
  const button_on_click=()=>{
    let data1={cmd:"select * from bj_syy"}
    Client.get('/rest/sql', data1, res => {
      console.log(res);
      // if (!res.items2) res.items2 = [];
      // setState({
      //   ...state,
      //   contact: res.contact,
      //   items: res.items,
      //   items2: res.items2,
      //   totalid: res.totalid,
      //   totalct: res.totalct,
      // });
    });
  }
  return (
    <Box sx={{ flexGrow: 1 }}>
      <AppBar position="static">
        <Toolbar>
          <IconButton
            size="large"
            edge="start"
            color="inherit"
            aria-label="menu"
            sx={{ mr: 2 }}
            
          >
            <MenuIcon />
          </IconButton>
          <Typography variant="h6" component="div" sx={{ flexGrow: 1 }}>
            News
          </Typography>
          <Button color="inherit"
          onClick={button_on_click}
          >Login</Button>
        </Toolbar>
      </AppBar>
      {props.children}
    </Box>
  );
}
